import { createBrowserRouter } from "react-router-dom";
import Home from "../Home";
import { DocEditorDemo } from "../pages/Doc/DocEditorDemo";
import ProjectManagement from "../pages/ProjectManagement";
import OKRTreePage from "../pages/OKRTree";

// 解决 react-router-dom 类型问题
type PickRouter<T> = T extends (...args: any[]) => infer R ? R : never;

type A = typeof createBrowserRouter;

export const router: PickRouter<A> = createBrowserRouter([
  {
    path: "/",
    element: <Home />,
    children: [
      // {
      //   path: "doc/:id",
      //   element: <DocEditorDemo />
      // }
    ]
  },
  {
    path: "doc/:id",
    element: <DocEditorDemo />
  },
  {
    path: "project-management",
    element: <ProjectManagement />
  },
  {
    path: "okr-tree",
    element: <OKRTreePage />
  }
]);
